@extends('layouts.admin.application')

@section('content')
    <div class="main-content">
        <div class="col-xs-12">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="#">首页</a></li>
                    <li><a href="{{ route('ads.ad.index') }}">广告管理</a></li>
                    <li class="active">新增广告</li>
                </ul>
            </div>

            @include('layouts.partials._flash')

            <form class="form-horizontal" role="form" action="{{ route('ads.ad.store') }}" method="post"
                  style="margin-top: 10px;">

                {{csrf_field()}}

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">所属分类</label>

                    <div class="col-sm-9">
                        <select class="width-40" name="category_id">
                            <option>请选择图片类型</option>

                            @foreach($categories as $category)
                                <option value="{{$category->id}}">{{$category->name}}</option>
                            @endforeach

                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">广告标题</label>

                    <div class="col-sm-9">
                        <input type="text" name="title" placeholder="广告标题，你懂得~" class="col-xs-10 col-sm-5">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">广告图</label>

                    <div class="col-sm-9">
                        <div class="am-form-group am-form-file new_thumb">
                            <button type="button" class="btn-success upload_img" style="width: 120px;">
                                <i class="icon-cloud-upload" id="loading"></i> 上 传 图 片
                            </button>
                            <input type="file" id="image_upload" style="display: none;">
                            <input type="hidden" name="image">
                        </div>
                        <hr style="border-top:1px dashed #0066CC;">
                        <div>
                            <img src="" id="img_show" style="max-height: 200px;">
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">广告地址</label>

                    <div class="col-sm-9">
                        <input type="text" name="url" class="col-xs-10 col-sm-5">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">排序</label>

                    <div class="col-sm-9">
                        <input type="text" name="sort_order" class="col-xs-10 col-sm-5">
                    </div>
                </div>

                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info" type="submit"><i class="icon-ok bigger-110"></i>保存</button>
                        &nbsp; &nbsp; &nbsp;
                        <a class="btn" onclick="javascript:history.back(-1);return false;"><i
                                    class="icon-undo bigger-110"></i>返回</a>
                    </div>
                </div>
            </form>
        </div>

    </div>
@endsection

@section('js')
    <script src="/vendor/html5-fileupload/jquery.html5-fileupload.js"></script>
    <script src="/js/upload.js"></script>
@endsection